package com.ctrip.corp.obt.shard.sql.parser.forbidden;

/**
 * @author xukang zhang
 * @date 2023/8/16 13:36
 */
public interface UpdateForbiddenMatcher {

    /**
     * whether if matches specified rule
     * @param propertyName
     * @param propertyValue
     * @param parameterObject
     * @return
     */
    boolean match(String propertyName, Object propertyValue, Object parameterObject, String columnName);

    /**
     * the name of this UpdateForbiddenMatcher for logging
     * @return
     */
    default String name() {
        return getClass().getSimpleName();
    }

    /**
     * whether if skip remaining matchers
     * @return
     */
    default boolean skip(String propertyName, Object propertyValue, Object parameterObject, String columnName) {
        return false;
    }

    /**
     * the order of UpdateForbiddenMatcher when matching (the lower, with the higher priority)
     * @return
     */
    default int order() {
        return 100;
    }
}
